/**
 * 登录模块
 * @author 张云江
 * @date 2016-05-13
 */
function Pay() {
    //URL配置
    this.url = {
        "orderlist": APP + '/pay/orderlist',
        "dingyue": APP + '/pay/dingyue',
        "notice": APP + '/pay/noticelist',
    };
}

Pay.prototype = {
    /**
     * 初始化
     */
    init: function () {
        var that = this;
    },

    /**
     * 搜索按钮点击事件
     */
    search:function (){
        var type = $("select[name='type']").val ();
        var stxt = $("input[name='stxt']").val ();
        var application_id = $("#application_id").val();

        if (Common.isEmpty(type) || type < 1 || type > 2) {
            Common.layerMsg("请选择正确的搜索选项",5);
            return;
        }

        var start_time = $("#start_time").val();
        var end_time = $("#end_time").val();

        if (Common.isEmpty(start_time) && !Common.isEmpty(end_time)){
            layer.msg("请选择开始时间!",{icon:5,shade:[0.5]});
            return;
        }

        if (!Common.isEmpty(start_time) && Common.isEmpty(end_time)){
            layer.msg("请选择截止时间!",{icon:5,shade:[0.5]});
            return;
        }

        if (Common.isEmpty(start_time) || Common.isEmpty(end_time)) {
            window.location.href = this.url.orderlist + "?stxt=" + stxt + "&type=" + type + "&application_id=" + application_id;
        } else {
            window.location.href = this.url.orderlist + "?stxt=" + stxt + "&type=" + type + "&application_id=" + application_id + "&begin_dt='" + start_time + "'&end_dt='" + end_time+"'";
        }
    },

    /**
     * 搜索按钮点击事件
     */
    searchDingyue:function (){
        var type = $("select[name='type']").val ();
        var stxt = $("input[name='stxt']").val ();
        var application_id = $("#application_id").val();

        if (Common.isEmpty(type) || type < 1 || type > 2) {
            Common.layerMsg("请选择正确的搜索选项",5);
            return;
        }

        window.location.href = this.url.dingyue + "?stxt=" + stxt + "&type=" + type + "&application_id=" + application_id;
    },

    /**
     * 搜索按钮点击事件
     */
    searchNotice:function (){
        var application_id = $("#application_id").val();

        window.location.href = this.url.notice + "&application_id=" + application_id;
    },

};